package com.mapper;


import com.domain.BoxHistory_data;
import com.domain.Box_data;
import com.service.Public_funtion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class BoxHistory_mysql {

    //快递柜历史记录
    @Autowired
    JdbcTemplate jdbcTemplate;

    @Resource
    private Public_funtion p;


    //添加文件到历史记录里面
    public String insert_boxhistory(BoxHistory_data box)
    {
        String send_string = "";
        String sql="INSERT INTO BoxHistory (id,locker_id,place,code,phone,boxtype,staff,otherIfo,name,time,outtime,yun_num)" +
                " VALUES(" +
                "'',"+
                "'"+box.getLocker_id()+"',"+
                "'"+box.getPlace()+"',"+
                "'"+box.getCode()+"',"+
                "'"+box.getPhone()+"',"+
                "'"+box.getBoxtype()+"',"+
                "'"+box.getStaff()+"',"+
                "'"+box.getOtherIfo()+"',"+
                "'"+box.getName()+"',"+
                "'"+box.getTime()+"',"+
                "'"+box.getOuttime()+"',"+
                "'"+box.getYun_num()+"'"+
                ")";
        sql=sql.replaceAll("''","NULL");
         jdbcTemplate.update(sql);
        return "快递柜物品已添加到快递柜历史记录表内"+box.getPhone();
    }

}
